# 开发环境的定义
VERSION = debug

ifeq ($(VERSION), release)
C_FLAGS = -O3 -Wall
else
C_FLAGS = -g -Wall
endif

# include

INC = -I./ 
LIB =  -lpthread -lm -lz

SRCS = $(wildcard *.cpp)
OBJS = $(patsubst %.cpp,../obj/%.o,$(SRCS))
BIN=index

../bin/$(BIN):$(OBJS)
	$(CXX) $(C_FLAGS) -o ../bin/$(BIN) $(OBJS) $(LIB)

../obj/%.o:%.cpp
	$(CXX) $(C_FLAGS) $(INC) -c $< -o $@


install: 
	mkdir -p /usr/local/index /usr/local/index/bin/ /usr/local/index/dat /usr/local/index/conf /usr/local/index/logs /var/indexdb/binlog
	cp ../bin/* /usr/local/index/bin/ -f
	cp -u ../conf/index.conf /usr/local/index/conf/
clean:
	rm -fr ../obj/*.o ../bin/$(BIN)
	rm -rf ../log/*
